package api

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

type LoginRspData struct {
	UserId uint   `json:"userId"`
	Token  string `json:"token"`
}

type LoginRsp struct {
	Code    uint         `json:"code"`
	Message string       `json:"message"`
	Result  LoginRspData `json:"result"`
}

// ------------------------------------------------------------------------------
//
// ------------------------------------------------------------------------------
func Login(c *gin.Context) {
	c.PureJSON(http.StatusOK, LoginRsp{
		Code:    0,
		Message: "success",
		Result: LoginRspData{
			UserId: 1,
			Token:  "123",
		},
	})
}

type GetUserInfoRspData struct {
	Roles    []string `json:"roles"`
	UserId   uint     `json:"userId"`
	UserName string   `json:"username"`
	RealName string   `json:"realName"`
	Avatar   string   `json:"avatar"`
	Desc     string   `json:"desc"`
}

type GetUserInfoRsp struct {
	Code    uint               `json:"code"`
	Message string             `json:"message"`
	Result  GetUserInfoRspData `json:"result"`
}

// ------------------------------------------------------------------------------
//
// ------------------------------------------------------------------------------
func GetUserInfo(c *gin.Context) {
	c.PureJSON(http.StatusOK, GetUserInfoRsp{
		Code:    0,
		Message: "success",
		Result: GetUserInfoRspData{
			Roles:    nil,
			UserId:   1,
			UserName: "teck",
			RealName: "teck",
			Avatar:   "",
			Desc:     "teck",
		},
	})
}
